package cn.catsdad.controller;

import cn.catsdad.base.controller.BaseCrudController;
import cn.catsdad.base.web.HttpResponse;
import cn.catsdad.dto.DepartmentDTO;
import cn.catsdad.page.DepartmentParam;
import cn.catsdad.service.api.DepartmentService;
import cn.catsdad.vo.TreeNodeVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 部门管理controller
 *
 * @author xuyonglong
 * @version V1.0 2023/4/20
 */
@RestController
@RequestMapping("/api/auth/departments")
public class DepartmentController extends BaseCrudController<DepartmentDTO, Long, DepartmentService, DepartmentParam> {

    /**
     * 查询部门树形
     *
     * @param param 查询参数
     * @return 树形
     */
    @GetMapping("/tree")
    public HttpResponse<List<TreeNodeVO>> queryTree(DepartmentParam param) {
        return new HttpResponse<List<TreeNodeVO>>().setData(service.queryTree(param));
    }

}
